class Calculator{
   int add(int i, int j)
  {
    return i+j;
 }

 float add(float i, float j)
   {


    return i+j;
  }
   
 double add(double i, double j)
 {
  return i+j;
  }

 double areaOfRectangle(double height, double width)
 {
   
   return height*width;

 }
double areaOfCircle(double r)
 {
   return 3.142*r*r;

}



public int[] genFib(int n)
{

   int[] fib=new int[n];
  
   fib[0]=0;
   fib[1]=1;
   for(int i=2;i<n;i++)
    {
           fib[i]=fib[i-1]+fib[i-2];
    }   
   return fib;
}


//  Print 1D Array

public void printArray(int[] a)
{
  for(int i=0;i<a.length;i++)
  {
  
   System.out.println(" " +a[i]);
}

}

// quick sort 

public static void quickSort(int a[],int low, int len)  
      {  
      if(low>=len) return;    
      int l=low,n=len; 
      int piv=a[(l+n)/2]; 
      while(l<n)
           {  
                while(l<n && a[l]<piv)   
                     l++;   
           
                while(l<n && a[n]>piv)  
                     n--;   
            
               if(l<n){  
                 int tem = a[l];  
                 a[l]=a[n];  
                 a[n]=tem; }             
           }
           if(n<l)
           {  
            int t = l;l=n;n=t;   
           }  
           quickSort(a,low,l);
           quickSort(a,l==low?l+1:l,len);
      }  

public void linearSearch(int k,int[] a)
{
   int s=k;
       int index=-1;

       for(int j=0;j<(a.length-1);j++)
       {
          if(a[j]==s)
          {
             index=j;

             break;
          }
       }

       if(index!=-1)
       {
          System.out.println(" The search element is : " + s);
          System.out.println(" It is found in the array at position : " +index);
       }

       else
          System.out.println("\n The search element is not found in the array.");
    }
 }



